package com.training1.core.web.controller.hl;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.training1.core.common.controller.BaseController;
import com.training1.core.common.utils.StringUtils;



@Controller
@RequestMapping("jQuery")
public class ValidationController extends BaseController{

	@RequestMapping("preValidate")
	public String JQueryValidate(){
		return "validate/validate";
	}
	
	
	@RequestMapping("validate")
	@ResponseBody
	public String validate(@RequestParam String name, String password, String phone, String email){
		
		if(StringUtils.isNotEmpty(name) && StringUtils.isNoneEmpty(password) && StringUtils.isNoneEmpty(phone) && StringUtils.isNoneEmpty(email)){
			System.out.println("name = " + name );
			System.out.println("password = " + password );
			System.out.println("phone = " + phone );
			System.out.println("email = " + email );
			return "1" ;
		}else {
			return "0";
		}
		
	}
	
}
